#include <iostream>
#include "Bit.h"
#include "Omvandla.h"

using namespace std;

int main()
{
	Bit test;
	char sum, cu;
	Omvandla om, om1, om2;
	string tal, tal1, tal2, summa;
	Bitstr bs;



	//om.tal_str(5, tal, 8);
	//cout << tal << endl;
	//om.tal_str(-5, tal, 8);
	//cout << tal << endl;
	//cout << om.str_tal(tal) << endl;
	//om.tal_str(5, tal, 8);
	//cout << tal << endl;
	//cout << om.str_tal(tal) << endl;

	om1.tal_str(6, tal1, 8);
	om1.tal_str(7, tal2, 8);
	bs.addstr(tal1, tal2, summa);
	cout << tal1 << endl;
	cout << tal2 << endl;
	cout << summa << endl;

	





	cout << ">>>> AND-GATE <<<<" << endl;
	cout << "0, 0: " << test.and('0', '0') << endl;
	cout << "1, 0: " << test.and('1', '0') << endl;
	cout << "0, 1: " << test.and('0', '1') << endl;
	cout << "1, 1: " << test.and('1', '1') << endl << endl;

	cout << ">>>> OR-GATE <<<<" << endl;
	cout << "0, 0: " << test.or('0', '0') << endl;
	cout << "1, 0: " << test.or('1', '0') << endl;
	cout << "0, 1: " << test.or('0', '1') << endl;
	cout << "1, 1: " << test.or('1', '1') << endl << endl;

	cout << ">>>> XOR-GATE <<<<" << endl;
	cout << "0, 0: " << test.xor('0', '0') << endl;
	cout << "1, 0: " << test.xor('1', '0') << endl;
	cout << "0, 1: " << test.xor('0', '1') << endl;
	cout << "1, 1: " << test.xor('1', '1') << endl << endl;

	cout << ">>>> ADD <<<<" << endl;
	cout << "ci: 0" << endl;
	test.add('0', '0', '0', sum, cu);
	cout << "0, 0: " << sum << ", " << cu << endl;
	test.add('1', '0', '0', sum, cu);
	//cout << "1, 0: " << sum << ", " << cu << endl;
	//test.add('0', '1', '0', sum, cu);
	//cout << "0, 1: " << sum << ", " << cu << endl;
	//test.add('1', '1', '0', &sum, &cu);
	//cout << "1, 1: " << sum << ", " << cu << endl;
	//cout << "ci: 1" << endl;
	//test.add('0', '0', '1', &sum, &cu);
	//cout << "0, 0: " << sum << ", " << cu << endl;
	//test.add('1', '0', '1', &sum, &cu);
	//cout << "1, 0: " << sum << ", " << cu << endl;
	//test.add('0', '1', '1', &sum, &cu);
	//cout << "0, 1: " << sum << ", " << cu << endl;
	//test.add('1', '1', '1', &sum, &cu);
	//cout << "1, 1: " << sum << ", " << cu << endl;


	system("PAUSE");
	return 0;
}